<!--info.less-->
<template>
	<section id="recharge">
		<HeaDer :Title='titleData'></HeaDer>
		<section class="iconList" @click="show = true">
			<i class="van-icon van-icon-pending-orders"></i>
		</section>
		<section class="rechargeWarp">
			<section class="title">
				<h2>账户充值</h2>
			</section>
			<section class="ewm">
				<div class="img">
					<img :src="userData.img">
				</div>
				<p class="save">长按保存图片</p>
			</section>
			<section class="linkAddress">
				<!--<p class="adderss"></p>-->
				<input type="text" :value="userData.links" class="address" id="link"/>
				<p class="ale" @click="copy('link')" >点击复制链接</p>
			</section>
			<section class="instructions">
				<p>
					复制链接或二维码发送给好友，通过本链接注册成功，都会返佣给你的账户
				</p>
			</section>
		</section>
		
		<van-popup v-model="show" position="right" :overlay="false">
  			<section class="contents">
  				<section class="return" @click="show = false">
  					<i class="van-icon van-icon-arrow-left"></i>
  				</section>
  				<section class="contentsListWarp">
  					<section class="title">
  						<h2>充值记录</h2>
  					</section>
  					<section class="contentsList">
  						<img src="../../../static/img/nolist.png" v-show="contentsList.length == 0"/>
  					</section>
  				</section>
  			
  			</section>
		</van-popup>
	</section>
</template>

<script>
	import HeaDer from "../common/header.vue";
	export default {
		data() {
			return {
				show:false,
				contentsList:[],
				titleData: {
					name: '',
					flat: 1
				},
				userData:{
					img:'http://img.mp.itc.cn/upload/20161007/b6a4693671ea41dbbe48a546411eab21.jpg', //图片
					links:'' //链接
				}
			}
		},
		methods: {
			
			getData(){
				var _this = this;
				_this.$http.post(_this.$host.bpay,{mobile:sessionStorage.mobile}).then(function(data){
					if(data.data.status == 200){
						_this.$toast(data.data.msg);
						_this.userData.img = _this.$host.host + '/' + data.data.data.qrc;
						_this.userData.links = data.data.data.url
					}
					
				}).catch(function(){})
			},
			copy(link){
				var _this = this;
				var ele = document.getElementById(link);
				ele.select();
				document.execCommand("Copy");
				_this.$toast('复制成功');
			}
		},
		components: {
			'HeaDer': HeaDer

		},
		created: function() {
			var _this = this;
			_this.getData();
		}
	}
</script>

<style>

</style>